package com.study.talk.ui.app.home.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.AdapterView.OnItemClickListener
import android.widget.ArrayAdapter
import com.study.talk.ui.app.base.BaseFragment
import com.study.talk.ui.app.moment.MomentsActivity
import com.study.talk.databinding.FragmentOtherBinding
import com.study.talk.utils.extras.toMoments

class OtherFragment : BaseFragment() {

    private lateinit var binding: FragmentOtherBinding

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
    ): View {
        binding = FragmentOtherBinding.inflate(inflater, container, false)
        initData()
        return binding.root
    }

    private fun initData() {

        val menu = listOf("动态")

        binding.otherFragmentListView.adapter =
            ArrayAdapter(requireContext(), android.R.layout.simple_list_item_1, menu)

        binding.otherFragmentListView.onItemClickListener =
            OnItemClickListener { _, _, position: Int, _ ->
                if (position == 0) {
                    //默认是本地用户查看其所有朋友的朋友圈
                    toMoments(MomentsActivity.MOMENT_ALL,-1)
                }
            }
    }
}